/**
 * Created by Administrator on 2019/9/2.
 */

window.addEventListener('message',function(e){
    console.log(444);
    var token = e.data;
    console.log(token);
    if(token){
        $.cookie('xyf_token', token, {  path: '/', secure: false });
    }
},false);

var frames = window.frames;
var i;
for (i = 0; i < frames.length; i++) {

    console.log(frames[i]);
    // console.log(frames[i].getCookie());
    // console.log(frames[i].contentWindow.getCookie());
    // console.log( $("#xyfToken",frames[0].document).val());
    console.log(7777777);
    // console.log(frames[i].contentWindow.getCookie());
    //console.log( frames[i].contentWindow.getCookie());



}

//向主页面传送cookie
if (top.location != self.location){
    console.log(333);
    console.log($.cookie('xyf_token'));
    window.parent.postMessage($.cookie('xyf_token'),'*');
}
window.parent.postMessage($.cookie('xyf_token'),'*');


if (top.location == self.location){
    //  token = window.frames[0].contentWindow.getCookie();
}
